home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.db.awt;
-
- import java.awt.Image;
-
- public class ImageStringData implements Data {
- StringBuffer text;
- // $FF: renamed from: im java.awt.Image
- Image field_0;
- String origText;
- boolean changed;
- DataSource dataSource;
-
- public ImageStringData(DataSource ds) {
- this(ds, "", (Image)null);
- }
-
- public ImageStringData(DataSource ds, String t) {
- this(ds, t, (Image)null);
- }
-
- public ImageStringData(DataSource ds, Image i) {
- this(ds, (String)null, i);
- }
-
- public ImageStringData(DataSource ds, String t, Image i) {
- this.changed = false;
- this.dataSource = ds;
- this.text = new StringBuffer(t);
- this.origText = t;
- this.field_0 = i;
- }
-
- public int type() {
- if (this.text != null && this.field_0 != null) {
- return 3;
- } else {
- return this.field_0 == null ? 1 : 2;
- }
- }
-
- public boolean isEditable(int row, int col) {
- return this.dataSource.isDataEditable(row, col);
- }
-
- public boolean changed() {
- return this.changed;
- }
-
- public void rollback() {
- this.text.setLength(0);
- this.text.append(this.origText);
- this.changed = false;
- }
-
- public void commit() throws TypeNotSupported {
- if (this.changed) {
- this.origText = this.text.toString();
- this.changed = false;
- }
-
- }
-
- public boolean isMasked() {
- return false;
- }
-
- public String getMask() throws TypeNotSupported {
- throw new TypeNotSupported("ImageStringData does not support choices");
- }
-
- public boolean supportsChoice() {
- return false;
- }
-
- public Data[] getChoices() throws TypeNotSupported {
- throw new TypeNotSupported("ImageStringData does not support choices");
- }
-
- public void setImage(Image i) {
- this.changed = true;
- this.field_0 = i;
- }
-
- public void setText(String t) {
- this.text.setLength(0);
- this.text.append(t);
- this.changed = true;
- }
-
- public void setText(char c) {
- this.text.setLength(0);
- this.text.append(c);
- this.changed = true;
- }
-
- public void insertChar(int pos, char c) {
- this.text.insert(pos, c);
- this.changed = true;
- }
-
- public void appendChar(char c) {
- this.text.append(c);
- this.changed = true;
- }
-
- public String subString(int spos, int epos) {
- return this.text.toString().substring(spos, epos);
- }
-
- public void deleteChar(int pos) {
- if (pos > 0) {
- String t = this.text.toString();
- this.text.setLength(0);
- this.changed = true;
- if (pos >= t.length()) {
- this.text.append(t.substring(0, t.length() - 1));
- } else {
- this.text.append(t.substring(0, pos - 1));
- this.text.append(t.substring(pos, t.length()));
- }
- }
- }
-
- public void clearText() {
- this.text.setLength(0);
- this.changed = true;
- }
-
- public String toString() {
- return this.text.toString();
- }
-
- public Image toImage() {
- return this.field_0;
- }
- }
-